/*
 * @(#)SokalSneathFunction.java
 *
 * Revision:
 * Author                                         Date           
 * --------------------------------------------   ------------   
 * Ana Emília Victor Barbosa Coutinho             25/06/2012    
 */
package br.edu.ufcg.splab.techniques.reduction.functions.similarity;


import br.edu.ufcg.splab.generator.TestCase;


public class SokalSneathFunction extends JaccardIndex{

	private final double W = 2.0;
	
	/**
	 * Sokal Sneath similarity.
	 * 
	 * This family of measures is defined based on commonalities and differences between two sets of inputs.
	 * 
	 * sim(A,B) = |A intersection B|/|A intersection B| + w * (|A union B| - |A intersection B|)
	 * 
	 * w = 2
	 *  
	 * The weight that the measure puts on differences between input sets (|A union B|-|A intersection B|), 
	 * where for the same inputs, similarity is lower for Sokal than Jaccard.
	 *
	 *
	 * @param path1 first test case.
	 * @param path2 second test case.
	 * @return similarity's value between the two paths. 
	 */
	public double getSimilarity(TestCase path1, TestCase path2){
		return getSimilarity(path1, path2, W);
	}
	
	/**
     * Provide a string representation of the similarity function to be written.
     * @return The string representation of the similarity function.
     */
	public String getFunctionName(){
		return "Sokal-Sneath";//"SK";
	}

}
